import React from "react";
import  "../css/Borard.css"
import eventEmitter from "../event"
class Borard extends React.Component{
    constructor(prop){
        super(prop)
        this.state={
            list:[]
        }
    }
    componentDidMount(){
        eventEmitter.addListener("sendMessageTooBoard",(message)=>{
            console.log(message)
            this.state.list.push(message);
            this.setState({
                message:this.state.messages 
            })
        })
    }

    render(){
        return(
            <div className="borard">
                {
                    this.state.list.map((element,index)=>{
                        return <div className="message" key="index">
                            <h3>{element.content}</h3>
                            <h3>{element.data}</h3>
                        </div>
                    })
                }
            </div>
        )
    }
}

export default Borard;